USE [Training]
GO

IF NOT EXISTS (SELECT * FROM sys.objects WHERE OBJECT_ID = OBJECT_ID(N'dbo.TrainingRecord') AND type in (N'U'))	

CREATE TABLE [dbo].[TrainingRecord](
	[TrainingRecordID] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeID] [int] NOT NULL,
	[DueDate] [datetime] NOT NULL,
	[CompletedDate] [datetime] NULL,
	[SkillID] [int] NOT NULL,
	[InspectedBy] [int] NULL,
	[LastModified] [datetime] NULL,
 CONSTRAINT [PK_TrainingRecord] PRIMARY KEY CLUSTERED 
(
	[TrainingRecordID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[TrainingRecord]  WITH CHECK ADD  CONSTRAINT [FK_TrainingRecord_Employee] FOREIGN KEY([InspectedBy])
REFERENCES [dbo].[Employee] ([EmployeeID])
GO

ALTER TABLE [dbo].[TrainingRecord] CHECK CONSTRAINT [FK_TrainingRecord_Employee]
GO



